package com.bionic.banking.auth.manager;

import java.util.ResourceBundle;

public class Message {

    private static Message instance = null;
    private ResourceBundle resource = null;
    private static final String BUNDLE_NAME = "com.bionic.banking.auth.manager.messages";
    public static final String SERVLET_EXCEPTION = "SERVLET_EXCEPTION";
    public static final String IO_EXCEPTION = "IO_EXCEPTION";
    public static final String LOGIN_ERROR = "LOGIN_ERROR";
    public static final String LOGOUT_ERROR = "LOGOUT_ERROR";
    public static final String CREATE_BANKACCOUNT_ERROR = "CREATE_BANKACCOUNT_ERROR";
    public static final String CURRENCY_NOTFOUND_ERROR = "CURRENCY_NOTFOUND_ERROR";
    public static final String CREATE_BANKTRANSACTION_ERROR = "CREATE_BANKTRANSACTION_ERROR";
    public static final String TRANSACTIONTYPE_NOTFOUND_ERROR = "TRANSACTIONTYPE_NOTFOUND_ERROR";
    public static final String BANKTRANSACTION_INSUFFICIENTFUNDS_ERROR = "BANKTRANSACTION_INSUFFICIENTFUNDS_ERROR";
    public static final String COMMAND_MISSING_ERROR = "COMMAND_MISSING_ERROR";

    public static Message getInstance() {
        if (instance == null) {
            instance = new Message();
            instance.resource = ResourceBundle.getBundle(BUNDLE_NAME);
        }
        return instance;
    }

    public String getProperty(String name) {
        return (String) resource.getObject(name);
    }
}